
<a role="button" ng-click="editObject()" data-toggle="modal" data-target="#myModal" class="btn btn-primary r" >新建分类</a>


<script type="text/ng-template" id="nodes_renderer.html">
    <div ui-tree-handle class="tree-node tree-node-content">
        <a class="btn btn-success btn-xs" ng-if="node.nodes && node.nodes.length > 0" data-nodrag ng-click="toggle(this)"><span
                class="glyphicon"
                ng-class="{
          'glyphicon-chevron-right': collapsed,
          'glyphicon-chevron-down': !collapsed
        }"></span></a>
        {{node.name}}  <span class="ml5">产品数量:{{ctp[node.objectId] || 0}} </span>
        <a class="pull-right btn btn-danger btn-xs"  data-nodrag ng-click="delete(this)" style="margin-left: 8px;"><span
                class="glyphicon glyphicon-remove"></span></a>
        <a class="pull-right btn btn-primary btn-xs" data-toggle="modal" data-target="#myModal"  data-nodrag ng-click="update(this)"><span
                class="glyphicon glyphicon-pencil"></span></a>
        <a class="pull-right btn btn-primary btn-xs"  data-toggle="modal" data-target="#myModal" data-nodrag ng-click="newSubItem(this)" style="margin-right: 8px;"><span
                class="glyphicon glyphicon-plus"></span></a>

    </div>
    <ol ui-tree-nodes="" ng-model="node.nodes" ng-class="{hidden: collapsed}">
        <li ng-repeat="node in node.nodes" ui-tree-node ng-include="'nodes_renderer.html'">
        </li>
    </ol>
</script>




<h4>分类树</h4>
<div class="row">
    <div class="col-sm-6">
        <div ui-tree id="tree-root" data-nodrop-enabled="true">
            <ol ui-tree-nodes ng-model="data">
                <li ng-repeat="node in data" ui-tree-node ng-include="'nodes_renderer.html'"></li>
            </ol>
        </div>
    </div>

    <!--<div class="col-sm-6">-->
        <!--<div class="info">-->
            <!--{{info}}-->
        <!--</div>-->
        <!--<pre class="code">{{ data | json }}</pre>-->
    <!--</div>-->
</div>





<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
    <div class="modal-dialog" role="document">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button"
                        class="close"
                        data-dismiss="modal"
                        aria-hidden="true">x</button>
                <h3 id="userMgrLabel">编辑分类</h3>
            </div>
            <div class="modal-body">

                <form name="userForm" class="form-horizontal" novalidate role="form">
                    <div class="form-group" show-errors>
                        <label class="col-sm-2 control-label">分类名</label>
                        <div class="col-sm-10">
                            <input type="text" ng-model="editClassification.name" name="name" class="form-control" required>
                            <p class="help-block" ng-if="userForm.name.$error.required">必填</p>
                        </div>
                    </div>



                </form>

            </div>

            <div class="modal-footer">
                <button class="btn" data-dismiss="modal" aria-hidden="true">取消</button>
                <button class="btn btn-primary"
                        data-dismiss="modal"
                        aria-hidden="true"
                        ng-click="save(editClassification)"
                >保存</button>
            </div>
        </div>
    </div>
</div>





